﻿using Dapper;
using DistpmbyNetCore.DBContext;
using Nancy;
using Newtonsoft.Json;

namespace DistpmbyNetCore.WEB.Module
{
    public class DepartmentModule: NancyModule
    {
        public DepartmentModule()
        {
            Get("/department/{name}", arg =>
            {
                using (var db=DapperDbContext.getConn())
                {
                    var list = db.Query<dynamic>("select * from department where deptname like @deptname",new {deptname="%"+arg.name+"%"});
                    return JsonConvert.SerializeObject(list);
                }

            });

        }
    }
}
